/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 * No deletion without permission, or be held responsible to law.
 * @author XPF
 */
import { defHttp } from '/@/utils/http/axios';
import { useGlobSetting } from '/@/hooks/setting';
import { BasicModel, Page } from '../model/baseModel';
import { UploadFileParams } from '/#/axios';
import { UploadApiResult } from '../sys/upload';
const { apiUrl, adminPath } = useGlobSetting();

export interface SportsSingleIndex extends BasicModel<SportsSingleIndex> {
  scoreId?: string; // 评分主键
  scoreAdaptSex?: string; // 评分适配性别
  scoreAdaptGrade?: string; // 评分适配年级（单选）
  indexId?: string; // 关联单项指标
  scoreSymbol?: string; // 评分对应分值符号“等与、小于等于、大于等于”
  score1?: string; // 分值1
  score2?: string; // 分值2“区间值不为空”
  isDelete?: string; // 删除标记
  scoreGradeId?: string; // 关联单项指标得分及对应等级
}

export const sportsSingleIndexList = (params?: SportsSingleIndex | any) =>
  defHttp.get<SportsSingleIndex>({ url: adminPath + '/sports/sportsSingleIndex/list', params });

export const sportsSingleIndexListData = (params?: SportsSingleIndex | any) =>
  defHttp.post<Page<SportsSingleIndex>>({
    url: adminPath + '/sports/sportsSingleIndex/listData',
    params,
  });

export const sportsSingleIndexGradeLevel = (params?: any, data?: SportsSingleIndex | any) =>
  defHttp.post<Page<SportsSingleIndex>>({
    url: adminPath + '/sports/sportsSingleIndex/selectGradeLevel',
    params,
    data,
  });

export const sportsSingleIndexForm = (params?: SportsSingleIndex | any) =>
  defHttp.get<SportsSingleIndex>({ url: adminPath + '/sports/sportsSingleIndex/form', params });

export const sportsSingleIndexSave = (params?: any, data?: SportsSingleIndex | any) =>
  defHttp.postJson<SportsSingleIndex>({
    url: adminPath + '/sports/sportsSingleIndex/save',
    params,
    data,
  });

export const sportsSingleIndexDelete = (params?: SportsSingleIndex | any) =>
  defHttp.get<SportsSingleIndex>({ url: adminPath + '/sports/sportsSingleIndex/delete', params });

export const saveGradeLevel = (params?: SportsSingleIndex | any) =>
  defHttp.post<Page<SportsSingleIndex>>({
    url: adminPath + '/sports/sportsSingleIndex/saveGradeLevel',
    params,
  });

export const importData = (
  params: UploadFileParams,
  onUploadProgress: (progressEvent: ProgressEvent) => void,
) =>
  defHttp.uploadFile<UploadApiResult>(
    {
      url: apiUrl + adminPath + '/sports/sportsSingleIndex/importData',
      onUploadProgress,
    },
    params,
  );

export const saveSingleIndex = (params?: SportsSingleIndex | any) =>
  defHttp.post<SportsSingleIndex>({
    url: adminPath + '/sports/sportsScoreGrade/saveSingleIndex',
    params,
  });
